<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%-- 
    JSP Name : da_100_12K.jsp
    Description : H-Volunteer 이벤트 등록
    author Seung Won
    since 2012. 8. 13.
    version 1.0
    Modification Information
       since          author              description
    ===========    =============    ===========================
    2012. 8. 13.     Seung Won     최초 생성
--%>

<%@ include file="/WEB-INF/jsp/co/us/include/declare.jspf" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>현대자동차 CSR &#124; H-Family Volunteer 이벤트</title>
<%@ include file="/WEB-INF/jsp/co/us/include/header.jspf" %>
<script type="text/javaScript" language="javascript">
<!--
$(document).ready(function() {
    /* form validation check */
    onloadCharCheck();
    
    $("#rgstButn").bind("click", moveRgstPage);    // 등록    
    $("#cnclButn").bind("click", formIniz);         /* Form 초기화 */
});

/*
 * 통화 표시
 */
function moneyType(argVal){
    
    var reg = /(^[+-]?\d+)(\d{3})/;
    argVal += '';
    while (reg.test(argVal))
        argVal = argVal.replace(reg, '$1' + ',' + '$2');

    return argVal;

}

/*
 * 등록, 수정 페이지 이동
 */
function moveRgstPage() {
    var arrChk = "0";
    var arrChkSzVal = "";
    var arrChkQtyVal = "";
    

    if (!validateForm($("#mainForm"))) {
        return;
    }
    
    var arrChk = "0";
    var arrChkVal = "";
    
    $("#aplcEml").val($("#aplcEml1").val()+"@"+$("#aplcEml2").val());
    $("#instCcpc").val($("#instCcpc1").val()+"-"+$("#instCcpc2").val()+"-"+$("#instCcpc3").val());

    $("#mainForm").attr('target','comIframe');
    <c:if test="${result.parp06Idx == null || result.parp06Idx == ''}">
    $("#mainForm").attr('action','/da_100_21.do').submit();
    </c:if>
    <c:if test="${result.parp06Idx != null && result.parp06Idx != ''}">
    $("#mainForm").attr('action','/da_100_23.do').submit();
    </c:if>
}

/*
 * Form 초기화
 */
function formIniz() {
    document.mainForm.reset();
}

/* table append rows */
function fe_appendTable(){
	$(".appendRow").click(function(){
		var tr_obj    = document.getElementById("lineAppend");
		var clone_obj = tr_obj.cloneNode(true)
		tr_obj.parentNode.appendChild(clone_obj);
	});

	$(".deleteRow").click(function(){
		var tr_obj    = document.getElementById("lineAppend");
		var tbody_obj = tr_obj.parentNode;
		var tbl_obj   = tbody_obj.parentNode;
		var tbl_cnt   = tbl_obj.rows.length;
		if(tbl_cnt < 3) {
			alert("삭제할 수 없습니다.");
		return;
		}
		tr_obj.parentNode.removeChild(tbl_obj.rows[tbl_cnt-1]);
	});
}

//-->
</script>
</head>
<body class="whiteBg">
<div class="popWrap">
    <div class="popCon">
        <p class="popTit">H-Family Volunteer<!-- img src="/img/usr/pop/pop_tit_h_volunteer_1.gif" alt="H-Family Volunteer 활동 신청" / --></p>
        <form id="mainForm" name="mainForm" method="post">
            <input type="hidden" id="currentPageNo" name="currentPageNo" value="${rqInfo.currentPageNo}" />
            <input type="hidden" id="parp06Idx" name="parp06Idx" value="${result.parp06Idx }" />
            <input type="hidden" id="evntIdx" name="evntIdx" value="${rqInfo.idx }" />
            <input type="hidden" id="mlgScnCd" name="mlgScnCd" value="KO" />
        <p class="popTit">1.신청자 정보<!-- img src="/img/usr/pop/pop_tit_h_volunteer_1.gif" alt="H-Family Volunteer 활동 신청" / --></p>
        <table border="1" summary="H-Family Volunteer 신청자이름, 핸드폰 이메일을 입력 또는 수정하는 표">
            <col width="16%" />
            <col width="34%" />
            <col width="16%" />
            <col width="34%" />
            <tbody>
                <tr>
                    <td class="subThead">신청자 이름</td> 
                    <td colspan="3"><input type="text" title="신청자 이름 " id="aplcNm" name="aplcNm" value="${result.ppprNm}" maxlength="10" nullable="true" /></td>
                    
                </tr>
                <tr>
                    <th>핸드폰</th>
                    <td colspan="3">
                        <select name="aplcHp1">
                                <option value="010" <c:if test="${result.aplcHp1 == '010' }">selected</c:if> >010</option>
                                <option value="011" <c:if test="${result.aplcHp1 == '011' }">selected</c:if> >011</option>
                                <option value="016" <c:if test="${result.aplcHp1 == '016' }">selected</c:if> >016</option>
                                <option value="017" <c:if test="${result.aplcHp1 == '017' }">selected</c:if> >017</option>
                                <option value="019" <c:if test="${result.aplcHp1 == '019' }">selected</c:if> >019</option>
                            </select> - <input type="text" class="phone" title="앞자리" id="aplcHp2" name="aplcHp2" value="${result.aplcHp2 }" maxlength="4" nullable="true" chartype="onlynum" /> - 
                            <input type="text" class="phone" title="뒤 4자리" id="aplcHp3" name="aplcHp3" value="${result.aplcHp3 }" maxlength="4" nullable="true" chartype="onlynum"  />
                    </td>
                </tr>
                <tr>
                    <th>이메일</th>
                    <td colspan="3"><input type="text" id="aplcEml1" name="aplcEml1" value="${arrAplcEml[0] }" maxlength="14" nullable="true" title="이메일" style="ime-mode:inactive" />
                     &#64; <input type="text" id="aplcEml2" name="aplcEml2" value="${arrAplcEml[1] }" maxlength="14" nullable="true" title="이메일" style="ime-mode:inactive;width: 130px"/><span class="desc">게시물 수정시 필요한 주소이므로 꼭 기억해 주세요.</span>
                     <input type="hidden" id="aplcEml" name="aplcEml" value="${result.aplcEml }"/>
                   </td>
                </tr>
                <tr>
                    <th>비밀번호</th>
                    <td colspan="3"><input type="password" title="비밀번호" value="" id="pw" name="pw" maxlength="14" nullable="true" chartype="password" csrEvType="Y"/><span class="desc">영소문자+숫자 조합으로 10자 이상으로 입력해주세요. 게시물 수정시 필요합니다.</span></td>
                </tr>
            </tbody>
        </table>
        <p class="popTit">2.참여자 정보<!--img src="/img/usr/pop/pop_tit_h_volunteer_2.gif" alt="봉사활동 관련내용" /--></p>
        
  		<div class="appendTable">
        <table border="1" summary="신청단체의 단체명,단체장,전화번호,휴대전화등 입력 또는 수정하는 표">
            <col width="13%" />
            <col width="11%" />
            <col width="26%" />
            <col width="10%" />
            <col width="13%" />
            <col width="*" />
            <tbody>
                <tr>
                    <td class="subThead" style="padding-left: 0;text-align: center;">구분</td>
                    <td class="subThead" style="padding-left: 0;text-align: center;">이름</td>
                    <td class="subThead" style="padding-left: 0;text-align: center;">생년월일</td>
                    <td class="subThead" style="padding-left: 0;text-align: center;">성별</td>
                    <td class="subThead" style="padding-left: 0;text-align: center;">소속</td>
                    <td class="subThead" style="padding-left: 0;text-align: center;">휴대전화</td>
                </tr>
                <c:choose>
                <c:when test="${hvt01List != null && !empty hvt01List }">
                <c:forEach var="hvt01List" items="${hvt01List }" varStatus="status">
                <tr id="lineAppend">
                	<td style="border-left: 0px">
                		<select name="famGubn">
                			<option value="01" <c:if test="${hvt01List.teamNm == '01' }">selected</c:if>>임직원</option>
                			<option value="02" <c:if test="${hvt01List.teamNm == '02' }">selected</c:if>>임직원가족</option>
                		</select>
                	</td>
                	<td>
                		<input type="text" title="이름 " id="famNm" name="famNm" value="${hvt01List.aplcNm }" maxlength="10" nullable="true" style="width: 90%"/>
                	</td>
                	<td style="padding-left: 0px;padding-right: 0;text-align: center;"> 
                		<select id="gactEraStrtY" name="gactEraStrtY">
                            <c:forEach var="list" items="${yearList }">
                            <option value="${list }" <c:if test="${hvt01List.gactEraStrtY == list }">selected</c:if> >${list }년</option>
                            </c:forEach>
                        </select>
                        <select id="gactEraStrtM" name="gactEraStrtM">
                            <c:forEach var="list" items="${monList }">
                            <option value="${list }" <c:if test="${hvt01List.gactEraStrtM == list }">selected</c:if> >${list }월</option>
                            </c:forEach>
                        </select>
                        <select id="gactEraStrtD" name="gactEraStrtD">
                            <c:forEach var="list" items="${dayList }">
                            <option value="${list }" <c:if test="${hvt01List.gactEraStrtD == list }">selected</c:if> >${list }일</option>
                            </c:forEach>
                        </select>
                	</td>
                	<td>
                		<select name="famSex">
                			<option value="M" <c:if test="${hvt01List.sex == 'M' }">selected</c:if>>남성</option>
                			<option value="F" <c:if test="${hvt01List.sex == 'F' }">selected</c:if>>여성</option>
	              		</select>
                	</td>
                	<td><input type="text" title="소속" id="famSosok" name="famSosok" value="${hvt01List.blns }" maxlength="10" nullable="true" style="width: 90%"/>
                	</td>
                	<td>    <select name="famHp1">
                                <option value="010" <c:if test="${hvt01List.aplcHp1 == '010' }">selected</c:if> >010</option>
                                <option value="011" <c:if test="${hvt01List.aplcHp1 == '011' }">selected</c:if> >011</option>
                                <option value="016" <c:if test="${hvt01List.aplcHp1 == '016' }">selected</c:if> >016</option>
                                <option value="017" <c:if test="${hvt01List.aplcHp1 == '017' }">selected</c:if> >017</option>
                                <option value="019" <c:if test="${hvt01List.aplcHp1 == '019' }">selected</c:if> >019</option>
                            </select> - <input type="text" class="phone" title="앞자리" id="famHp2" name="famHp2" value="${hvt01List.aplcHp2 }" maxlength="4" nullable="true" chartype="onlynum" style="width: 45px"/> - 
                            <input type="text" class="phone" title="뒤 4자리" id="famHp3" name="famHp3" value="${hvt01List.aplcHp3 }" maxlength="4" nullable="true" chartype="onlynum" style="width: 45px"/>
                	
                	</td>
                </tr>
                </c:forEach>
                </c:when>
                <c:otherwise>
                <c:forEach var="i"  begin="1" end="4">
                <tr id="lineAppend">
                	<td style="border-left: 0px">
                		<select name="famGubn">
                			<option value="01">임직원</option>
                			<option value="02">임직원가족</option>
                		</select>
                	</td>
                	<td>
                		<input type="text" title="이름 " id="famNm" name="famNm" value="" maxlength="10" nullable="true" style="width: 90%"/>
                	</td>
                	<td style="padding-left: 0px;padding-right: 0;text-align: center;"> 
                		<select id="gactEraStrtY" name="gactEraStrtY">
                            <c:forEach var="list" items="${yearList }">
                            <option value="${list }" >${list }년</option>
                            </c:forEach>
                        </select>
                        <select id="gactEraStrtM" name="gactEraStrtM">
                            <c:forEach var="list" items="${monList }">
                            <option value="${list }" >${list }월</option>
                            </c:forEach>
                        </select>
                        <select id="gactEraStrtD" name="gactEraStrtD">
                            <c:forEach var="list" items="${dayList }">
                            <option value="${list }"  >${list }일</option>
                            </c:forEach>
                        </select>
                	</td>
                	<td>
                		<select name="famSex">
                			<option value="M">남성</option>
                			<option value="F">여성</option>
	              		</select>
                	</td>
                	<td><input type="text" title="소속" id="famSosok" name="famSosok" value="${result.aplcNm }" maxlength="10" nullable="true" style="width: 90%"/>
                	</td>
                	<td>    <select name="famHp1">
                                <option value="010" >010</option>
                                <option value="011" >011</option>
                                <option value="016" >016</option>
                                <option value="017" >017</option>
                                <option value="019" >019</option>
                            </select> - <input type="text" class="phone" title="앞자리" id="famHp2" name="famHp2" value="" maxlength="4" nullable="true" chartype="onlynum" style="width: 45px"/> - 
                            <input type="text" class="phone" title="뒤 4자리" id="famHp3" name="famHp3" value="" maxlength="4" nullable="true" chartype="onlynum" style="width: 45px"/>
                	
                	</td>
                </tr>
                </c:forEach>
                </c:otherwise>
                </c:choose>
            </tbody>
        </table>
        <div class="btnRows" style="text-align: right;margin-top: 10px"><button type="button" class="appendRow"><img src="/img/usr/btn/btn_row_apd.gif" alt="추가" /></button><button type="button" class="deleteRow"><img src="/img/usr/btn/btn_row_del.gif" alt="삭제" /></button></div>
        </div>
        </form>
        <div class="btnPopArea">
            <input type="image" id="rgstButn" name="rgstButn" onClick="return false;" src="/img/usr/btn/btn_pop_reg.gif" title="등록" alt="등록" /><button type="button" onclick="javscript:document.mainForm.reset();"><img src="/img/usr/btn/btn_pop_cancel.gif" alt="취소" /></button>
        </div>
        <%
// 등록 process 를 위한 iFrame Start
%>
<iframe name="comIframe" id="comIframe" src="about:blank" height="0" width="0"></iframe>
<%
// 등록 process 를 위한 iFrame END
%>
    </div>
</div>
</body>
</html>
<script>
<c:if test="${result.pttShap == '2'}">
$(".team").removeClass("lock");
$('.team input[type="text"]').removeAttr("readonly");
</c:if>
</script>